package com.kefu.notice.vo;

import org.hibernate.validator.constraints.Length;

import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.notice.model.BossNoticeInfo;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "")
public class BossNoticeInfoInsertVo extends AbstractInsertVo<BossNoticeInfo> {

	@Length(min = 5,max = 50)
    @ApiModelProperty(value = "标题")
    private String title;
    
    @Length(min = 5,max = 5000)
    @ApiModelProperty(value = "内容")
    private String content;

    @Override
    public BossNoticeInfo convert() {
	    BossNoticeInfo info  = BeanUtil.toBean(this, BossNoticeInfo.class);
        KefuContext context = KefuContext.getKefuContext();
        info.setDataStatus(1);
        info.setPublishStatus(0);
	    info.setCreateTime(context.getNow());
	    info.setUpdateTime(context.getNow());
	    info.setCreateId(context.getUserId());
	    info.setUpdateId(context.getUserId());
	    return info;
	}
}